<template>
  <div class="mui-content">
    <div class="wrapper">
      <div class="title mui-text-center">教师端登录</div>
      <div  class="mui-text-center form">
        <div class="input"><input type="text" placeholder="手机号" id="top" v-model="tel" maxlength="11"></div>

        <div class="input"><input type="password" placeholder="密码" v-model="pwd" ></div>
        <div class="mui-text-right"><router-link to="/Regist">注册</router-link></div>
        <button @click="login">
          登录
        </button>

      </div>
    </div>

  </div>
</template>

<script>

  export default {
    name: "Regist.vue",
    components:{

    },
    data(){
      return {
        UserId:'',
        tel:'',
        pwd:'',
        unit:'',
        phoneCode:'',
        // phone:'',
        datt:''
      }
    },
    created(){
    },
    methods:{
      login(){
        this.checkPhone();
        try{
          this.$Global.zcServer.Post({
            IsNeedLogin: 'false',
            Paras:{
              UserId:this.$Global.UserId ,
              Name:'Vue_CourseResource',
              Action:'Ext_ResourceManagement_Login',
              Data:{
                Password: this.pwd,
                Telephone: this.tel
              }
            },
            Callback:this.cb_login,
            Scope:this
          });
        }
        catch(err) {
        }
      },
      cb_login(resJson,scope){
       if(resJson.success){
         console.log('zcWin:',this.$Global.zcWin);
         if (this.$Global.zcWin.doDirect()) return;
         localStorage.setItem('myPhone',this.tel);
         this.$router.push('/Index')
       }
      },
      checkPhone(){
        let tel =this.tel;
        let pwd =this.pwd;
        let reg=11 && /^[1]([0-9])[0-9]{9}$/;
        if(tel==''){
          alert("请输入手机号码");
        }else if(!reg.test(tel)){
          alert("手机格式不正确");
        }else if(pwd==''){
          alert('请输入密码')
        }
      },
    }
  }
</script>

<style scoped>
  .mui-content{
    position: absolute;
    left: 0 ;
    right: 0;
    top: 0 ;
    bottom: 0 ;
    background: url(../assets/img/zc_home2.png) no-repeat;
    background-size: 100% 100% ;
  }
  .mui-content .title{
    height: 30vh;
    line-height: 30vh;
    color: white;
    font-size: 1.1rem;
  }
  .mui-content .form input{

    width: 92%;
    border:1px solid rgba(93, 194, 240, 1);
    height: 40px;
    border-radius: 5px;
    margin-top: 0px;
  }
  .mui-content .form #top{
    margin-top: 8vh;
    border-radius: 5px;
  }

  .mui-content .form button{
    width: 92%;
    border:1px solid rgba(93, 194, 240, 1);
    /*outline: none;*/
    margin-top: 20px;
    height: 40px;
    line-height: 30px;
    background-color:rgba(93, 194, 240, 1) ;
    color: white;
    word-spacing: 10px;
  }
  .mui-content .input{
    display: inline;
  }
  .mui-content  .wrapper-user input{
    height: 39px;
  }

.mui-text-right a{
  margin-right: 40px;
  position: relative;
}
  .mui-text-right a:before{
 content: '';
    position: absolute;
  }
</style>
